home *** CD-ROM | disk | FTP | other *** search
/ PC Direct 1998 August / PC Direct August 1998.iso / S / powerj / Product / hpp.z / WMETAFIL.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-25  |  4.3 KB  |  138 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. /*************************************************************************
  12.  *
  13.  * WMetafile
  14.  *
  15.  *************************************************************************/
  16.  
  17. #ifndef _WMETAFIL_HPP_INCLUDED
  18. #define _WMETAFIL_HPP_INCLUDED
  19.  
  20. #ifndef _WNO_PRAGMA_PUSH
  21. #pragma pack(push,8);
  22. #pragma enum int;
  23. #endif
  24.  
  25. #ifndef _WCANVAS_HPP_INCLUDED
  26. #  include "wcanvas.hpp"
  27. #endif
  28.  
  29. class WMetafileReference;
  30.  
  31. class WCMCLASS WMetafile : public WObject {
  32.     WDeclareSubclass( WMetafile, WObject );
  33.     
  34.     public:
  35.  
  36.         /**********************************************************
  37.          * Constructors and Destructors
  38.          *********************************************************/
  39.  
  40.         WMetafile();
  41.         WMetafile( const WChar *fileName,
  42.                    const WChar *pictureTitle=NULL,
  43.                    const WChar *applicationName=NULL,
  44.                    const WInfoCanvas *referenceCanvas=NULL,
  45.                    const WRect *dimensions=NULL );
  46.         WMetafile( WMetafileHandle handle, WBool deleteHandle=FALSE );
  47.         WMetafile( const WMetafile & metafile );
  48.     
  49.         ~WMetafile();
  50.     
  51.         /**********************************************************
  52.          * Properties
  53.          *********************************************************/
  54.  
  55.         // Handle
  56.  
  57.         WMetafileHandle GetHandle() const;
  58.  
  59.         // Valid
  60.  
  61.         WBool GetValid() const;
  62.  
  63.         /**********************************************************
  64.          * Methods
  65.          *********************************************************/
  66.  
  67.         // Clear
  68.         //
  69.         //    Calls Close, then deletes the metafile from memory.
  70.  
  71.         void Clear();
  72.  
  73.         // Close
  74.         //
  75.         //    Closes a metafile opened with Create so that no
  76.         //    further drawing is possible.
  77.  
  78.         WBool Close();
  79.  
  80.         // Copy
  81.         //
  82.         //    Copies a metafile and returns a new WMetafile that
  83.         //    represents the copy.  If no filename is given, an
  84.         //    in-memory copy is made.  Free the returned metafile
  85.         //    using delete.
  86.  
  87.         WMetafile * Copy( const WChar * fileName=NULL );
  88.  
  89.         // Create
  90.         //
  91.         //    Create a new metafile.  If no filename is given,
  92.         //    the metafile is in-memory.  Returns a canvas which
  93.         //    is used to draw on the metafile. Do not delete the
  94.         //    canvas.  NULL is returned if an error occurred.
  95.  
  96.         WCanvas *Create( const WMetafile & metafile );
  97.         WCanvas *Create( WMetafileHandle handle, WBool deleteHandle=FALSE );
  98.         WCanvas *Create( const WChar * fileName=NULL,
  99.                           const WChar * pictureTitle=NULL,
  100.                           const WChar * applicationName=NULL,
  101.                           const WInfoCanvas * referenceCanvas=NULL,
  102.                           const WRect * dimensions=NULL );
  103.  
  104.         // Load
  105.         //
  106.         //    Load an already-existing metafile.
  107.  
  108.         WBool Load( const WChar * fileName );
  109.  
  110.         // Play
  111.         //
  112.         //    Plays a metafile into the given canvas, within the
  113.         //    bounding rectangle.
  114.  
  115.         WBool Play( const WCanvas & canvas, const WRect & bounds );
  116.  
  117.         /**********************************************************
  118.          * Operators
  119.          *********************************************************/
  120.  
  121.         WMetafile & operator=( const WMetafile & metafile );
  122.  
  123.         /**********************************************************
  124.          * Data members
  125.          *********************************************************/
  126.  
  127.     private:
  128.  
  129.         WMetafileReference *            _ref;
  130. };
  131.  
  132. #ifndef _WNO_PRAGMA_PUSH
  133. #pragma enum pop;
  134. #pragma pack(pop);
  135. #endif
  136.  
  137. #endif // _WMETAFIL_HPP_INCLUDED
  138.